<template>
    <h2>添加投资信息</h2>
    <table>
        <tr>
            <td>投资项目名称</td>
            <td><input type="text" placeholder="请输入投资项目名称" v-model="info.Iname" /></td>
        </tr>
        
        <tr>
            <td>投资总额度</td>
            <td><input type="text" placeholder="请输入投资总额度" v-model="info.IbigPrice" /></td>
        </tr>
        <tr>
            <td colspan="2">
                <button @click="AddInvest">提交</button>
            </td>
        </tr>
    </table>
</template>
<script setup lang="ts">
import { ref } from "vue";
import axios from "axios";
import { useRouter } from "vue-router";

const router = useRouter();



const info = ref({
    Iname:"",
    IbigPrice:"",
});

const AddInvest = () => {
    axios.post("http://localhost:53393/api/Invest/AddInvest", info.value)
    .then((res) => {
        if (res.data>0) {
            alert("添加成功");
            router.push("/ShowInvest");
            
        } else {
            alert("添加失败");
        }
    });
};


</script>